package com.example.panda.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.panda.R;
import com.example.panda.Item.StartTeamListItem;

import java.util.List;

public class StartTeamListAdapter extends ArrayAdapter {
    private int resId;

    public StartTeamListAdapter(@NonNull Context context, int listItemId, List<StartTeamListItem> obj) {
        super(context, listItemId,obj);
        resId = listItemId;
    }

    public StartTeamListAdapter(@NonNull Context context, int resource) {
        super(context, resource);
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        StartTeamListItem info =(StartTeamListItem) getItem(position);
        View view = LayoutInflater.from(getContext()).inflate(resId, parent,false);
        TextView tv = (TextView)view.findViewById(R.id.tv_list01);
        tv.setText(info.getNumber());
        EditText tv1 = (EditText) view.findViewById(R.id.tv_list02);
        tv1.setHint(info.getNumbertwo());
        ImageView iv = (ImageView)view.findViewById(R.id.list_img);
        iv.setImageResource(info.getImg());

        return view;
    }
}
